# Maintainer: Torsten Keßler <tpkessler at archlinux dot org>
# Contributor: Jingbei Li <i@jingbei.li>

pkgname=intel-oneapi-dev-utilities
_pkgver=2021.9.0
_debpkgrel=44447
pkgver=${_pkgver}_${_debpkgrel}
pkgrel=2
pkgdesc="Intel oneAPI Dev Utilities"
arch=('loong64' 'x86_64')
url='https://software.intel.com/content/www/us/en/develop/tools/oneapi.html'
license=("custom")
source=("https://apt.repos.intel.com/oneapi/pool/main/${pkgname}-${_pkgver}-${_pkgver}-${_debpkgrel}_amd64.deb"
        "https://apt.repos.intel.com/oneapi/pool/main/${pkgname}-eclipse-cfg-${_pkgver}-${_debpkgrel}_all.deb")
b2sums=('cc9bdc2f3aeeb08bf5961b9fb290debcb15c16c4f5b6f1ce0bc131ddb330957a0a18100d60b0b8adc78014f820d0b643d05eb8209dda8e5e521f7d6ebcb4c559'
        '340dd93bc962737daba3492638074375f2a71a1cf314b504b8b21c07ce99a3a24986ade47a53c3619680fa5495d82ffa094a77ce625c8a9a186d16fc06908830')
depends=('intel-oneapi-common')
provides=("${pkgname}-eclipse-cfg")
conflicts=('intel-oneapi-basekit')

noextract=(
	"${pkgname}-${_pkgver}-${_pkgver}-${_debpkgrel}_amd64.deb"
	"${pkgname}-eclipse-cfg-${_pkgver}-${_debpkgrel}_all.deb"
)

package() {
    cd "${srcdir}"
	ar x ${pkgname}-${_pkgver}-${_pkgver}-${_debpkgrel}_amd64.deb
    tar xvf data.tar.xz -C "${pkgdir}"
	rm data.tar.xz

	ar x ${pkgname}-eclipse-cfg-${_pkgver}-${_debpkgrel}_all.deb
    tar xvf data.tar.xz -C "${pkgdir}"
	rm data.tar.xz

    local _dev_path='/opt/intel/oneapi/dev-utilities'
    ln -s "${_dev_path}/${_pkgver}" "${pkgdir}/${_dev_path}/latest"

    install -d "${pkgdir}"/usr/share/licenses/"${pkgname}"
    ln -s /usr/share/licenses/intel-oneapi "${pkgdir}"/usr/share/licenses/"${pkgname}"/oneapi
}
